import React, { PureComponent } from 'react';
import Header from './components/header';
import Tuijian from './components/tuijian';
import MiaoshaObj from './components/miaosha'
import axios from 'axios';
import Content from './components/content'
import Recommand from './components/recommand';
import withQuickBtn from '../../components/hoc/QuickBtn'
class Main extends PureComponent {
    constructor(props) {
        super(props);
        this.state = {
            swiperList: [],
            tuijianList: [],
            miaoshaObj:null
        }
    }
    componentDidMount() {
        axios.post("/appapi/api/root-ceo-content/hpPageConfigure/pageList",
            { channelId: null, memberKey: "" }).then(res => {
                // console.log(res);
                this.setState({
                    swiperList: res.data.data[1].configureAttribute,
                    tuijianList: res.data.data[9].configureAttributeList,
                    miaoshaObj:res.data.data[4]
                })
            });
    }
    render() {
        const { swiperList, tuijianList,miaoshaObj } = this.state;
        return (<>
               {swiperList.length !== 0 ? <Header swiperList={swiperList} /> : "" }
               <Content />
               {miaoshaObj!== null? <MiaoshaObj miaoshaObj={miaoshaObj}/> : ""}
               <Recommand />
            <Tuijian tuijianList={tuijianList} />
            
        </>);
    }
}

export default withQuickBtn(Main);